package com.cn.serverline.lineicp.productionLine.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import com.cn.serverline.lineicp.productionLine.entity.RollingImport;
import com.cn.serverline.lineicp.productionLine.service.IRollingImportService;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 滚动计划导入 接口
 *
 * @author 郭明然
 * @since 2024-08-22
 */
@RestController
@ApiResource(name = "滚动计划导入的接口")
public class RollingImportController {

    @Resource(name = "RollingImportServiceImpl")
    private IRollingImportService iRollingImportService;

    /**
     * 添加滚动计划导入
     */
    @PostResource(name = "添加滚动计划导入", path = "/productionLine/rollingImport/add")
    public ResponseData<RollingImport> add(@RequestBody @Validated RollingImport rollingImport){
        iRollingImportService.add(rollingImport);
        return new SuccessResponseData<>();
    }

    /**
     * 删除滚动计划导入
     */
    @PostResource(name = "删除滚动计划导入", path = "/productionLine/rollingImport/delete")
    public ResponseData<?> delete(@RequestBody @Validated RollingImport  rollingImport){
        iRollingImportService.del(rollingImport);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑滚动计划导入
     */
    @PostResource(name = "编辑滚动计划导入", path = "/productionLine/rollingImport/edit")
    public ResponseData<?> edit(@RequestBody @Validated RollingImport rollingImport) {
        iRollingImportService.edit(rollingImport);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-滚动计划导入列表
     */
    @GetResource(name = "分页查询-滚动计划导入列表", path = "/productionLine/rollingImport/page")
    public ResponseData<PageResult<RollingImport>> page(RollingImport rollingImport) {
        return new SuccessResponseData<>(iRollingImportService.findPage(rollingImport));
    }

}
